import request from '@/config/axios'

export interface CategoryFinanceVO {
  id: number
  status: string
  categoryName: string
  categoryFullname: string
  categoryCode: string
  serviceLife: number
  parentId: string
  sort: number
  hierarchy: string
  hierarchyName: string
  notes: string
}

// 查询财务分类分页
export const getCategoryFinancePage = async (params) => {
  return await request.get({ url: `/eam/category-finance/page`, params })
}

// 查询财务分类详情
export const getCategoryFinance = async (id: number) => {
  return await request.get({ url: `/eam/category-finance/get?id=` + id })
}

// 新增财务分类
export const createCategoryFinance = async (data: CategoryFinanceVO) => {
  return await request.post({ url: `/eam/category-finance/create`, data })
}

// 修改财务分类
export const updateCategoryFinance = async (data: CategoryFinanceVO) => {
  return await request.put({ url: `/eam/category-finance/update`, data })
}

// 删除财务分类
export const deleteCategoryFinance = async (id: number) => {
  return await request.delete({ url: `/eam/category-finance/delete?id=` + id })
}

// 导出财务分类 Excel
export const exportCategoryFinance = async (params) => {
  return await request.download({ url: `/eam/category-finance/export-excel`, params })
}